package net4.FaWave;

import net4.AccountInfo;
import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;


public class AccountManager {
	private DBHelper db_helper = null;
	private final String tableName = "Account";
	
	public AccountManager(Context context) {
		db_helper = new DBHelper(context, null, 1);
	}
	
	public void AddAccount(AccountInfo info){
		SQLiteDatabase db = db_helper.getWritableDatabase();
		db.beginTransaction();
		
		ContentValues values = new ContentValues();
		values.put("Platform", info.getPlatform());
		values.put("AuthType", info.getAuthType());
		values.put("UserName", info.getUserName());
		values.put("ScreenName", info.getScreenName());
		values.put("PassWord", info.getPassWord());
		values.put("UserId", info.getUserId());
		values.put("UserKey", info.getUserKey());
		values.put("UserSecret", info.getUserSecret());
		
		db.insert(tableName, "Id", values);
		
		db.setTransactionSuccessful();
		db.endTransaction();  
	}
	
	public void CloseDB(){
		db_helper.close();
	}
}
